from typing import List
from sentence_transformers import SentenceTransformer
from config import BGE_LARGE_EMBEDDING_MODEL


class EmbeddingModel:
    def __init__(self):
        self.model = SentenceTransformer(BGE_LARGE_EMBEDDING_MODEL)

    def encode(self, text: str) -> List[float]:
        """生成文本的嵌入向量"""
        return self.model.encode(text).tolist()


# 创建单例实例
embedding_model = EmbeddingModel()
